#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time : 2020/9/2 10:36
# @Author : wn 
# @File: mypage.py
# @SoftWare: PyCharm
# @Site:
# @Table:
#｡◕‿◕｡｡◕‿◕｡｡◕‿◕｡

def my_page(result, limit=None, offset=None):
    # 导出Excel请求处理
    # print('-- lim --', limit, '--off--', offset)
    if offset is None:
        return {'total': len(result), 'rows': result}
    elif (offset is not None) and (limit is not None):
        offset = int(offset)
        limit = int(limit)
        # s[0:20]
        return {'total': len(result), 'rows': result[offset: offset + limit]}
